﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/MainFrame.Master"
    Inherits="System.Web.Mvc.ViewPage<PagedList<GPMS.Model.File>>" %>
<%@ Import Namespace="Webdiyer.WebControls.Mvc" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    UserFile
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <p>
        <input id="file" type="file" name="Filedata" />
        <p>
            <a href="javascript:$('#file').uploadifyUpload()">上传文件</a></p>
        <p id="uploadmeg">
        </p>
    </p>
    <%Html.RenderPartial("UserFileList", Model); %>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Header" runat="server">
<link href="<%=Url.Content("~/Content/css/ui.jqgrid.css") %>" rel="Stylesheet" type="text/css" />
    <link type="text/css" rel="Stylesheet" href="<%: Url.Content("~/Content/css/uploadify.css") %>" />
    <link href="<%=Url.Content("~/Content/css/admin.css") %>" rel="Stylesheet" type="text/css" />
    
    <script type="text/javascript" src="<%=Url.Content("~/Scripts/jquery.layout.js") %>"></script>
    <script type="text/javascript" src="<%=Url.Content("~/Scripts/i18n/grid.locale-cn.js") %>"></script>
    <script type="text/javascript" src="<%=Url.Content("~/Scripts/jquery.jqGrid.min.js") %>"></script>
    <script type="text/javascript" src="<%: Url.Content("~/Scripts/Uploadify-v2.1.4/jquery.uploadify.v2.1.4.min.js") %>"></script>
    <script type="text/javascript" src="<%: Url.Content("~/Scripts/Uploadify-v2.1.4/swfobject.js") %>"></script>
    <style type="text/css">
        body
        {
            background: white;
        }
    </style>
    <script type="text/javascript">
        $(function () {
            var auth = "<% = Request.Cookies[FormsAuthentication.FormsCookieName]==null ? string.Empty : Request.Cookies[FormsAuthentication.FormsCookieName].Value %>";
            Grid($("#filesTable"));
            $('#file').uploadify({
                'uploader': '../../Content/uploadify.swf',
                'script': '/File/UploadUserFile',
                'method': 'post',
                'folder': '/UploadUserFile',
                'cancelImg': '../../Content/Images/cancel.png',
                'removeCompleted': true,
                'sizeLimit': 1024 * 1024 * 500, //4M
                onError: function (event, queueID, fileObj, errorObj) {
                    alert("Error!!! Type: [" + errorObj.type + "] Info [" + errorObj.info + "]");
                },
                onComplete: function fun(event, queueID, fileObj, response, data) {
                    if (response != "") {
                        $("#uploadmeg").text(response);
                        setTimeout(function () { document.location = document.location; }, 500);
                    }
                },
                scriptData: { token:auth }
            });
           

        });
    </script>
</asp:Content>
